<template>
  <div class="content-detail">
    <el-card class="card-box">
      <div class="card-box--headerwrap">
        <el-page-header
          icon="el-icon-arrow-left"
          content="审批详情"
          @back="handleBack"
        ></el-page-header>

        <!-- <div class="card-box--downloadbtn" v-if="contractId">
          <el-tooltip effect="dark" content="预览" placement="bottom">
            <template #default>
              <el-button
                circle
                type="primary"
                icon="el-icon-view"
                @click="handleView"
              ></el-button>
            </template>
          </el-tooltip>
          <el-tooltip effect="dark" content="下载" placement="bottom">
            <template #default>
              <el-button
                type="primary"
                circle
                icon="el-icon-download"
                @click="handleDownload"
              ></el-button>
            </template>
          </el-tooltip>
        </div> -->
      </div>
    </el-card>
    <content
      :instanceId="instanceId"
      :contractId="contractId"
      :nodeDefId="nodeDefId"
      :isEdit="isEdit"
      :flowId="flowId"
      :taskId="taskId"
    ></content>
  </div>
</template>

<script lang="ts" setup>
import { ref } from "vue";
import { useRoute, useRouter } from "vue-router";
// import { downloadpdf, viewpdf } from "/@/utils/download";
import content from "./content.vue";

const router = useRouter();
const route = useRoute();
let nodeDefId = ref(route.query.nodeDefId || "ACT_010");
let isEdit = ref(route.query?.mode !== "read");
let flowId = ref(route.query.flowId);
let taskId = ref(route.query.taskId);
let instanceId = route.query?.instanceId;
let contractId = ref(route.query?.contractId);

// 返回按钮事件
const handleBack = () => {
  router.push("/approval/todo");
};
// 下载事件
// const handleDownload = async () => {
//   if (!route.query?.contractId) {
//     return;
//   }
//   const { contractId, flowId, instanceId } = route.query;
//   const params = {
//     contractInfoId: contractId,
//     flowId: flowId,
//     instanceId: instanceId,
//     pdfName: cacheBillName.value
//   };
//   downloadpdf(params, "quality");
// };

// // 预览事件
// const handleView = async () => {
//   if (!route.query?.contractId) {
//     return;
//   }
//   const { contractId, flowId, instanceId } = route.query;
//   const params = {
//     contractInfoId: contractId,
//     flowId: flowId,
//     instanceId: instanceId
//   };
//   viewpdf(params, "quality");
// };
</script>

<style lang="scss" scoped></style>
